<?php

namespace modules\point\controller;

use OpenApi\Attributes as OA;
use modules\product\data\ProductData;


#[OA\Tag(name: '积分商品', description: '积分商品接口')]

class ApiPointController extends \core\ApiController
{
    protected $model = [
        'product' => "\modules\point\model\ProductModel",
    ];
    /**
     * 积分商品列表
     */
    #[OA\Get(
        path: '/point/api-point/index',
        summary: '获取积分商品列表',
        tags: ['积分商品'],

    )]
    public function actionIndex()
    {
        $list = $this->model->product->pager([
            'sys_tag' => 'point',
            'status' => 'success',
            'ORDER' => ['id' => 'DESC']
        ]);
        foreach ($list['data'] as &$v) {
            $v = ProductData::resetData($v);
            $v['price'] = (int)$v['price'];

        }
        json($list);
    }
}
